<template>
  <view class="contenter">
    <view class="bg-w techHead">
      <view class="u-flex headMian">
        <view class="headTime" @click="tabChangeIndex(index)" :class="{'active':index == tabIndex}" v-for="(data,index) in time">{{data}}</view>
      </view>
    </view>
    <view>
      <scroll-view  scroll-y="true" class="scroll-Y" >
        <view v-if="dataList.length!=0">
          <view v-for="(data,index) in dataList">
            <list-item :item="data" :index="index" :imgShow="false"></list-item>
          </view>
        </view>
        <view class="loading_text" v-else>
          <text>{{loadingText || '暂无数据'}}</text>
        </view>
      </scroll-view>
    </view>
  </view>
</template>

<script>
import ListItem from "../../components/item/list-item";
export default {
  name: "technician",
  components: {ListItem},
  data(){
    return{
      time:['好评率优先','订单量优先','销售额优先'],
      tabIndex:0,
      loadingText:'',
      dataList:[],
      type:1,

    }
  },
  onLoad(option){
    this.setData()

  },
  methods:{
    setData(){
      let form = {
        type:this.type,//1-好评率优先 2-服务订单优先 3-销售额优先 不填默认显示好评

      }
      this.$api.storeRanking(form).then(res=>{
        this.dataList = res.data
      })
    },

    //上拉加载
    onReachBottom(){
      // this.page ++
      // this.setData()
    },
    tabChangeIndex(index){
      this.type = index + 1
      this.tabIndex = index
      this.setData()
    },
  }

}
</script>

<style scoped lang="scss">
.techHead{
  .headMian{
    padding: 0 32rpx;
    padding-top: 20rpx;
    padding-bottom: 20rpx;
    .headTime{
      width: 218rpx;
      height: 80rpx;
      line-height: 80rpx;
      text-align: center;
      border-radius: 8rpx;
      margin-right: 16rpx;
      color: $uni-text-color-inverse;
      font-size: 28rpx;
      border: 2rpx solid $uni-border-color;
      &:last-child{
        margin: 0;
      }
    }
    .active{
      background: $uni-color-primary;
      border: 2rpx solid $uni-color-primary;
      color: white;
    }
  }
}


</style>